<?php

namespace App\Events;

use GuzzleHttp\Client;

class RefreshUserInfo extends Event
{
    private $agentId;

    public function __construct($agentId)
    {
        $this->agentId = $agentId;
    }

    public function handle()
    {
        try {
            // -通知-> Hyperf -(socket)-> 客户端
            (new Client(['base_uri' => env('SDJ_HYPERF_URI')]))
                ->patch('api/h5/v2/user/refresh-info', [
                    'json' => [
                        'agent_id' => $this->agentId
                    ]
                ]);
        } catch (\Exception $e) {
            \Log::error($e);
        }
    }
}
